package com.corpgovernment.common.enums;

/**
 * 开关枚举
 */
public enum SwitchEnum {

	/**
	 * 启用
	 */
	E("E", "启用"),

	/**
	 * 停用
	 */
	N("N", "停用");

	private String code;

	private String name;

	SwitchEnum(String code, String name) {
		this.code = code;
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public String getName() {
		return name;
	}

	/**
	 * 根据code转换枚举
	 */
	public static SwitchEnum getEnumByCode(String code) {
		for (SwitchEnum item : SwitchEnum.values()) {
			if (item.getCode().equalsIgnoreCase(code)) {
				return item;
			}
		}
		return SwitchEnum.N;
	}
}
